//
//  RHVideoUploadView.m
//  RuiHeAppApp
//
//  Created by bill on 2024/7/14.
//

#import "RHVideoUploadView.h"
@interface RHVideoUploadView()
@property (nonatomic ,strong) QMUILabel *progressLab;

@end
@implementation RHVideoUploadView

-(instancetype)init
{
    if(self = [super init]){
        [self setupUI];
    }
    return self;
}

-(void)setProgress:(CGFloat)progress
{
    _progress = progress;
    self.progressLab.text = [NSString stringWithFormat:@"%ld%%",(NSInteger)(progress*100)];
}

-(void)setupUI
{
    kWeakSelf;
    _coverImg = [[UIImageView alloc]init];
    _coverImg.layer.cornerRadius = 5;
    _coverImg.layer.masksToBounds = YES;
    [self addSubview:_coverImg];
    [_coverImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.width.height.offset(25);
        make.centerY.mas_offset(0);
    }];
    
    UIImageView *playIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"service_video_play"]];
    [self addSubview:playIcon];
    [playIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(10);
        make.center.equalTo(weakSelf.coverImg);
    }];
    
    QMUILabel *titleLab = [QMUILabel labelWithText:@"正在上传视频".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"#3F4443", 0.5)];
    [titleLab sizeToFit];
    titleLab.textAlignment = NSTextAlignmentLeft;
    [self addSubview:titleLab];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.coverImg.mas_right).offset(10);
        make.centerY.equalTo(weakSelf.coverImg);
        make.width.offset(titleLab.width+2);
    }];
    
    QMUILabel *progressLab = [QMUILabel labelWithText:@"0%" font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"#3F4443", 0.5)];
    progressLab.textAlignment = NSTextAlignmentLeft;
    [self addSubview:progressLab];
    self.progressLab = progressLab;
    [progressLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLab.mas_right).offset(10);
        make.centerY.equalTo(weakSelf.coverImg);
        make.right.mas_offset(-5);
    }];
}

@end
